import service from "../utils/requestTwo";


// GET   info    /admin/acl/index/info
// POST  login   /admin/acl/index/login
// POST  logout  /admin/acl/index/logout

export interface LoginModel {
    phone: string,
    password: string
}

export interface TokenModel {
    token: string
}

export interface UserInfoModel {
    // avatar: string,
    // name: string,
    // buttons: string[],
    // roles: string[],
    // routes: string[]


    birthday: null,
    createTime: string,
    email: null,
    gender: string,
    headImg: string,
    id: number,
    loginName: string,
    name: string,
    nickName: string,
    openId: null,
    operateTime: string,
    passwd: string,
    phoneNum: string,
    status: string,
    userLevel: string,

}

export default {
    getInfo() {
        return service.get<any, UserInfoModel>(`/user/passport/auth/getUserInfo`)
    },
    logout() {
        return service.get<any, null>(`/user/passport/logout`)
    },
    PostLogin(username: LoginModel) {
        return service.post<any, TokenModel>(`/user/passport/login`, username)
    },
    PostuserKode(formData: any) {
        return service.post(`/user/passport/register`, formData)
    },
    GetVerificationCode(phone: string) {
        return service.get(`/user/passport/sendCode/${phone}`)
    }
}
